<template>
  <div id="ygd">
    <el-table
      ref="multipleTableRef"
      border
      style="width: 100%; cursor: pointer"
      @row-click="RowListData"
      :data="useTable.tableList"
      @selection-change="handleSelectionChange"
    >
      <el-table-column type="selection" width="55" />

      <el-table-column label="序号" fixed="left" width="60" type="index" />
      <!-- 循环表头的数据 -->
      <template v-for="item in useTable.tableHeader" :key="item.property">
        <el-table-column :property="item.property" :label="item.lable" v-if="item.isShow" show-overflow-tooltip />
      </template>
      <el-table-column fixed="right" label="操作" width="200">
        <template #default="scope">
          <el-button link type="primary" size="small">复制</el-button>
          <el-button link type="primary" size="small" @click.stop="removeItemTable(scope.row.id)">删除</el-button>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>

<script lang="ts" setup name="Ygd">
// Ygd
// 引入事件总线并切换路由的时候卸载
import bus from '@/libs/bus'

import useStore from '@/stores'
const { useTable } = useStore()

const RowListData = () => {
  console.log('🌈成功->123')
}
const handleSelectionChange = () => {
  console.log('🌈成功->123')
}

const removeItemTable = (row: any) => {
  console.log('🌈成功->信息')
}

// 刷新当前页面
bus.$on('reloadPage', () => {
  reload()
})
const reload = inject('reload') as any
</script>

<style lang="scss" scoped>
#Ygd {
}
</style>
